package com.xingkeduo.util.pojo.exception;

/**
 * 入参错误异常，用于接口入参的判断
 * 
 * @author GJ
 * @time 2018年12月12日 下午4:10:01
 * @description
 */
public class InputParamException extends RuntimeException
{
	private static final long serialVersionUID = -8132022656936946115L;

	public enum Type
	{
		DEFAULT("02001", ""), NULL("02002", "不存在"), EMPTY("02003", "空值"), INVALID("02004", "非法");

		private String code;
		private String msg;

		private Type(String code, String msg)
		{
			this.code = code;
			this.msg = msg;
		}

		public String getCode()
		{
			return this.code;
		}

		public String getMsg()
		{
			return this.msg;
		}
	}

	public InputParamException(Type type, String message)
	{
		StringBuffer messageCreator = new StringBuffer().append(message).append(type.msg);
		this.message = messageCreator.toString();
		this.code = type.code;
	}

	private String code;
	private String message;

	public String getCode()
	{
		return code;
	}

	public void setCode(String code)
	{
		this.code = code;
	}

	public String getMessage()
	{
		return message;
	}

	public void setMessage(String message)
	{
		this.message = message;
	}

	public static String getDefaultCode()
	{
		return Type.DEFAULT.code;
	}
}
